package src.Players;

import src.Main;
import src.NPCs.*;
import java.util.ArrayList;

public class PlayerInstance
{
    private int bufferSize = 30000;
    public boolean itemPickup = false, npcOption1 = false, npcOption2 = false, npcOption3 = false, objectClick1 = false,
    objectClick2 = false, objectClick3 = false;
    public int myShopId = 0;
    public int attackNPC = 0, attackPlayer = 0, combatDelay = 0, tradePlayer = 0, duelPlayer = 0;
    public int tradingWith = 0, duelingWith = 0;
    public boolean attackingNPC = false, attackingPlayer = false;
    public boolean tradingPlayer = false, duelingPlayer = false;
    public boolean inTrade = false, inDuel = false;
    public boolean tradeAccepted = false, duelAccepted = false;
    public boolean acceptedFirstScreen = false, acceptedSecondScreen = false;
    public boolean updateShop = false;
    public int standEmote = 0x328, walkEmote = 0x333, runEmote = 0x338;
    public boolean isOnline = false, initialized = false;
    public int readPtr, writePtr, maxWritePtr;
    public int playerIndex;
    public ArrayList<Integer> offeredItems = new ArrayList<Integer>();
    public int rights = 0;
    public int canWalkDelay = 0, eatDelay = 0, deathDelay = 0, drinkDelay = 0, skillDelay = 0;
    public int saveGameDelay = 20;
    public boolean isDead = false, isInWild = false;
    public int clickX = 0, clickY = 0, clickId = 0;
    public int skillId = 0, statRestoreDelay = 5;
    public String username;
    public String password;
    public int loadingDelay = 2;
    public int totalLvl = 0, totalXP = 0;
    public int dir1 = 0, dir2 = 0;
    public int absX = 0, absY = 0;
    public boolean isRunning = false;
    public int walkingQueueSize = 50;
    public int newWalkCmdSteps = 0;
    public int numTravelBackSteps = 0;
    public int wQueueReadPtr = 0;
    public int wQueueWritePtr = 0;
    public boolean takeAsNote = false;
    public boolean mapRegionDidChange = false;
    public boolean didTeleport = false;
    public int mapRegionX = -1, mapRegionY = -1;
    public int heightLevel = 0;
    public int combatLevel = 3;
    public int interfaceId = -1;
    public int currentX = 0, currentY = 0;
    public int teleportToX = -1, teleportToY = -1;
    public int packetIndex = -1, packetSize = 0;
    public int playerListSize = 0;
    public int chatTextEffects = 0, chatTextColor = 0;
    public boolean updateRequired = false, appearanceUpdateRequired = false, chatTextUpdateRequired = false, 
    animUpdateRequired = false, gfxUpdateRequired = false, faceToUpdateRequired = false, hit1UpdateRequired = false, 
    mask400 = false;
    public int hitDiff1 = 0, posionHit1 = 0;
    public int faceToRequest = 65535;
    public int animRequest = 65535, animDelay = 0;
    public int gfxRequest = 65535, gfxDelay = 0;
    public int npcListSize = 0;
    public int npcType = -1;
    public int dialogue = -1;
    public boolean rebuildNPCList = false;
    public int[] equipment;
    public int[] equipmentN;
    public int[] walkingQueueX, walkingQueueY, newWalkCmdX, newWalkCmdY, travelBackX, travelBackY;
    private byte[] buffer;
    public Player[] playerList;
    public byte[] playerInListBitmap;
    public NPC[] npcList;
    public byte[] npcInListBitmap;
    public byte chatText[], chatTextSize = 0;
    public boolean[] disconnected;
    public int[] skillLvl, skillXP;
    public int[] items, itemsN;
    public int[] bankItems, bankItemsN;
    public int[] equipmentBonus;
    public int[] killedBy;

    public PlayerInstance()
    {
        equipment = new int[14];
        equipmentN = new int[14];
        skillLvl = new int[21];
        skillXP = new int[21];
        for(int i = 0; i < equipment.length; i++)
        {
            equipment[i] = -1;
            equipmentN[i] = 0;
        }
        for(int i = 0; i < skillLvl.length; i++)
        {
            skillLvl[i] = 1;
        }
        skillLvl[3] = 10;
        skillXP[3] = 1155;
        walkingQueueX = new int[walkingQueueSize];
        walkingQueueY = new int[walkingQueueSize];
        travelBackX = new int[walkingQueueSize];
        travelBackY = new int[walkingQueueSize];
        newWalkCmdX = new int[walkingQueueSize];
        newWalkCmdY = new int[walkingQueueSize];
        playerList = new Player[Main.m.ge.maxPlayers];
        playerInListBitmap = new byte[(Main.m.ge.maxPlayers + 7) >> 3];
        npcList = new NPC[Main.m.ge.maxNPCs];
        npcInListBitmap = new byte[(Main.m.ge.maxNPCs + 7) >> 3];
        chatText = new byte[4096];
        disconnected = new boolean[2];
        items = new int[28];
        itemsN = new int[28];
        bankItems = new int[Main.m.ge.item.maxBankSize];
        bankItemsN = new int[Main.m.ge.item.maxBankSize];
        equipmentBonus = new int[12];
        buffer = new byte[getBufferSize()];
        killedBy = new int[Main.m.ge.maxPlayers];
    }

    public int getBufferSize()
    {
        return bufferSize;
    }

    public byte[] getBuffer()
    {
        return buffer;
    }
}